package com.example.productviewserviceribbon.service;

import com.example.productviewserviceribbon.dao.entity.Product;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.client.RestTemplate;

import java.util.List;

@Component
public class ProductClientRibbon {
    Logger logger= LoggerFactory.getLogger(ProductClientRibbon.class);
    @Autowired
    private RestTemplate restTemplate;
    public List<Product> listProducts(){
        logger.info("restTemplate==null="+(restTemplate==null));
        List<Product> forObject = restTemplate.getForObject("http://ProductDataService/products", List.class);
        return forObject;
    }
}
